package com.hospital.new_yygh;

import com.wxapi.WxApiCall.WxApiCall;
import com.wxapi.model.RequestModel;

import java.util.*;

public class HttpClient {
    public static void main(String[] args) throws Exception {

        /*String secretKey = "8bd197d133e3b9e55a2570cfb3d0de63";
        long timestamp = System.currentTimeMillis();
        String sign = Hashing.md5().hashString(secretKey+timestamp, Charset.forName("UTF-8")).toString();*/

        Scanner s = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        String name = s.nextLine();
        System.out.println("请输入你的年龄：");
        int age = s.nextInt();
        System.out.println("请输入你的性别：");
        String sex = s.next();
        System.out.println("请描述你的症状：");
        String description = s.next();
        System.out.println(name+age+sex+description);


        RequestModel model = new RequestModel();
        model.setGwUrl("https://aiapi.jd.com/jdai/intelligent_triage");
        model.setAppkey("f1158f3e7629310b205ac71fda8ad3eb");
        model.setSecretKey("8bd197d133e3b9e55a2570cfb3d0de63");
        model.setBodyStr("{\""+"description\""+":"+"\""+description+"\""+","+"\"patientInformation\""+":{\"name\":"+"\""+name+"\""+",\"age\":"+"\""+age+"\""+",\"sex\":"+"\""+sex+"\""+"}}");
        System.out.println("{\""+"description\""+":"+"\""+description+"\""+","+"\"patientInformation\""+":{\"name\":"+"\""+name+"\""+",\"age\":"+"\""+age+"\""+",\"sex\":"+"\""+sex+"\""+"}}");
        Map queryMap = new HashMap();
        queryMap.put("x-ai-request-id","2f21e3de77ba4b4ab03cadb823ad145c");//访问参数
        model.setQueryParams(queryMap);
        WxApiCall call = new WxApiCall();
        call.setModel(model);
        String res = call.request();
        System.out.println(res);
    }
}
